<template>
<!--我的订单-->
  <div class="orders">
      <p v-html="content">
      </p>
    <Spin fix v-show="isSpinShow" >
      <div class="loader">
        <Icon type="ios-loading" size=26 class="demo-spin-icon-load"></Icon>
        <div class="font14">加载中...</div>
      </div>
    </Spin>
  </div>
</template>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less" rel="stylesheet/less">
  /* 旋转效果 */
  .demo-spin-icon-load{
    animation: ani-demo-spin 1s linear infinite;
  }
  @keyframes ani-demo-spin {
    from { transform: rotate(0deg);}
    50% { transform: rotate(180deg);}
    to { transform: rotate(360deg);}
  }
  /* 假如内容过长，一屏放不下，滚动条下拉覆盖不全 */
  .ivu-spin-fix {
    position: fixed;
  }

  p{
    line-height: 35px;
  }
</style>
<script type="text/ecmascript-6">
  import centers from '../template/center'
  import {centreInfoWeb, getMessage} from '../../http'
    export default {
        name: 'orderdetail',
        props: {},
        data() {
            return {
              content:'',       //消息内容
              title:'',         //消息标题
              noticeId:this.$route.query.noticeId,      //消息Id
              isSpinShow:false,
            };
        },
        methods: {},
        created() {
          if(this.isSpinShow === false) {
            this.isSpinShow = true;
            //用户是否登录
            centreInfoWeb().then(res => {
              if (res.code === 200) {
                //获取消息详情
                getMessage({noticeId: this.noticeId}).then(res => {
                  if(res.code === 200) {
                    this.isSpinShow = false;
                    this.content = res.data.content;
                    this.title = res.data.htmlTitle;
                  }else {
                    this.isSpinShow = false;
                    this.$Notice.warning({
                      title: "个人中心提醒",
                      desc: res.info,
                      duration: 3,
                    });
                  }
                }).catch()
              }else {
                this.isSpinShow = false;
              }
            }).catch()
          }
        },
        components: {
          centers
        }
    }
</script>
